package com.ly.count.impl.room;
 
import com.ly.count.impl.room.transfer.CPlusRoomUserTransfer;
import com.ly.count.room.bo.CPlusRoomUserBO;
import com.ly.count.room.mapper.CPlusRoomUserMapper;
import com.ly.count.room.param.CPlusRoomUserPage;
import com.ly.count.room.po.CPlusRoomUser;
import com.ly.count.room.transfer.RoomTransferHelper;
import com.ly.count.room.vo.CPlusRoomUserVO;
import com.ly.count.service.room.CPlusRoomUserService;
import com.ly.count.http.CPlusResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.utils.ResponseModelUtils;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * Module: CPlusRoomUser.java
 * 
 * @author liaoyong
 * @since JDK 1.8
 * @version 1.0
 * @date 2024-10-03
 * @Descriptions:
 */
@Service("cPlusRoomUserService")
public class CPlusRoomUserServiceImpl extends ServiceImpl<CPlusRoomUserMapper, CPlusRoomUser> implements CPlusRoomUserService {
 		
 	public CPlusResponse<CPlusRoomUserVO> selectOne(CPlusRoomUser cPlusRoomUser){
 		Wrapper<CPlusRoomUser> queryWrapper = new QueryWrapper<>(cPlusRoomUser);


		 return ResponseModelUtils.body(RoomTransferHelper.getIns().toVO(getOne(queryWrapper)));
 	
 	}
	
	public CPlusResponse<Object>	add( CPlusRoomUserBO clusRoomUserBO){

		 CPlusRoomUser cPlusRoomUser = CPlusRoomUserTransfer.toPO(clusRoomUserBO);
		boolean result = save(cPlusRoomUser);
		if(result) {		
			return ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	
	public CPlusResponse<Object>	modify(CPlusRoomUser cPlusRoomUser){

		boolean result = updateById(cPlusRoomUser);
		if(result) {
			return ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	
	public CPlusResponse<Page<CPlusRoomUser>> pageList(CPlusRoomUserPage cPlusRoomUserPage){


		 Page<CPlusRoomUser> page = CPlusRoomUserTransfer.toPage(cPlusRoomUserPage);
		return  ResponseModelUtils.body(page(page,new QueryWrapper<CPlusRoomUser>()));
	}

}
